home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / UTIL / SCREEN / CURSES01 / minix / c / clrtobot < prev    next >
Text File  |  1992-02-26  |  3KB  |  109 lines

  1. /****************************************************************/
  2. /* Wclrtobot() routine of the PCcurses package            */
  3. /*                                */
  4. /****************************************************************/
  5. /* This version of curses is based on ncurses, a curses version    */
  6. /* originally written by Pavel Curtis at Cornell University.    */
  7. /* I have made substantial changes to make it run on IBM PC's,    */
  8. /* and therefore consider myself free to make it public domain.    */
  9. /*        Bjorn Larsson (...mcvax!enea!infovax!bl)    */
  10. /****************************************************************/
  11. /* 1.0:    Release:                    870515    */
  12. /****************************************************************/
  13. /* Modified to run under the MINIX operating system by Don Cope */
  14. /* These changes are also released into the public domain.      */
  15. /*                             900906  */
  16. /****************************************************************/
  17.  
  18. #include <curses.h>
  19. #include "curspriv.h"
  20.  
  21. /****************************************************************/
  22. /* Wclrtobot() fills the right half of the cursor line of    */
  23. /* window 'win', and all lines below it with blanks.        */
  24. /****************************************************************/
  25.  
  26. int    wclrtobot(win)
  27.   WINDOW    *win;
  28.   {
  29.   int     y;
  30.   int   minx;
  31.   static int     startx;
  32.   static int    *ptr;
  33.   static int    *end;
  34.   static int    *maxx;
  35.   static int     blank;
  36.  
  37.   blank = ' ' | (win->_attrs & ATR_MSK);
  38.   startx = win->_curx;
  39.   for (y = win->_cury; y <= win->_regbottom; y++)
  40.     {
  41.     minx = _NO_CHANGE;
  42.     end = &win->_line[y][win->_maxx];
  43.     for (ptr = &win->_line[y][startx]; ptr <= end; ptr++)
  44.       {
  45.       if (*ptr != blank)
  46.     {
  47.     maxx = ptr;
  48.     if (minx == _NO_CHANGE)
  49.       minx = ptr - win->_line[y];
  50.     *ptr = blank;
  51.     } /* if */
  52.       } /* for */
  53.     if (minx != _NO_CHANGE)
  54.       {
  55.       if ((win->_minchng[y] > minx) ||  (win->_minchng[y] == _NO_CHANGE))
  56.     win->_minchng[y] = minx;
  57.       if (win->_maxchng[y] < maxx - win->_line[y])
  58.     win->_maxchng[y] = maxx - win->_line[y];
  59.       } /* if */
  60.     startx = 0;
  61.     } /* for */
  62.   return(OK);
  63.   } /* wclrtobot */
  64.  
  65. /****************************************************************/
  66. /* Wclrtobot() fills the right half of the cursor line of    */
  67. /* stdscr, and all lines below it with blanks.            */
  68. /****************************************************************/
  69. int clrtobot()
  70.   {
  71.   return(wclrtobot(stdscr));
  72.   } /* clrtobot */
  73.  
  74. int clrbot()
  75.   {
  76.   return(wclrtobot(stdscr));
  77.   } /* clrbot */
  78.  
  79. /****************************************************************/
  80. /* Mvclrtobot() moves the cursor to a new position in stdscr    */
  81. /* and fills the right half of the cursor line, and all lines    */
  82. /* below it with blanks.                    */
  83. /****************************************************************/
  84.  
  85. int mvclrtobot(y,x)
  86.   int y;
  87.   int x;
  88.   {
  89.   if (wmove(stdscr,y,x) == ERR)
  90.     return(ERR);
  91.   return(wclrtobot(stdscr));
  92.   } /* mvclrtobot */
  93.  
  94. /****************************************************************/
  95. /* Mvwclrtobot() moves the cursor to a new position in window    */
  96. /* 'win', and fills the right half of the cursor line, and all    */
  97. /* lines below it with blanks.                    */
  98. /****************************************************************/
  99.  
  100. int mvwclrtobot(win,y,x)
  101.   WINDOW *win;
  102.   int y;
  103.   int x;
  104.   {
  105.   if (wmove(win,y,x) == ERR)
  106.     return(ERR);
  107.   return(wclrtobot(win));
  108.   } /* mvwclrtobot */
  109.